const mongoose = require('mongoose');

// MongoDB连接配置
const connectDB = async () => {
  try {
    await mongoose.connect('mongodb://root:rzc22q9l@nzp-db0-mongodb.ns-q0f1pd1l.svc:27017', {
      useNewUrlParser: true,
      useUnifiedTopology: true
    });
    console.log('MongoDB连接成功');
  } catch (error) {
    console.error('MongoDB连接失败:', error.message);
    process.exit(1);
  }
};

module.exports = connectDB; 